package androidx.core.app;

import android.app.Notification;
import android.app.Notification.BigTextStyle;
import android.app.PendingIntent;
import android.app.RemoteInput;
import android.content.Context;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.media.AudioAttributes.Builder;
import android.net.Uri;
import android.os.Build.VERSION;
import android.os.Bundle;
import android.os.Parcelable;
import android.widget.RemoteViews;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.annotation.RequiresApi;
import androidx.annotation.RestrictTo;
import java.util.ArrayList;
import java.util.Iterator;
import o.fj;
import o.fl;
import o.fn;

public class NotificationCompat {

    public static class Action {
        private final RemoteInput[] ʻ;
        private final RemoteInput[] ʼ;
        private boolean ʽ;
        public int ˊ;
        final Bundle ˋ;
        boolean ˎ;
        public PendingIntent ˏ;
        public CharSequence ॱ;
        private final int ᐝ;

        public Action(int i, CharSequence charSequence, PendingIntent pendingIntent) {
            this(i, charSequence, pendingIntent, new Bundle(), null, null, true, 0, true);
        }

        Action(int i, CharSequence charSequence, PendingIntent pendingIntent, Bundle bundle, RemoteInput[] remoteInputArr, RemoteInput[] remoteInputArr2, boolean z, int i2, boolean z2) {
            this.ˎ = true;
            this.ˊ = i;
            this.ॱ = d.ˎ(charSequence);
            this.ˏ = pendingIntent;
            if (bundle == null) {
                bundle = new Bundle();
            }
            this.ˋ = bundle;
            this.ʻ = remoteInputArr;
            this.ʼ = remoteInputArr2;
            this.ʽ = z;
            this.ᐝ = i2;
            this.ˎ = z2;
        }

        public int ˏ() {
            return this.ˊ;
        }

        public CharSequence ˊ() {
            return this.ॱ;
        }

        public PendingIntent ˎ() {
            return this.ˏ;
        }

        public Bundle ˋ() {
            return this.ˋ;
        }

        public boolean ॱ() {
            return this.ʽ;
        }

        public RemoteInput[] ॱॱ() {
            return this.ʻ;
        }

        public int ʻ() {
            return this.ᐝ;
        }

        public RemoteInput[] ᐝ() {
            return this.ʼ;
        }

        public boolean ʼ() {
            return this.ˎ;
        }
    }

    public static abstract class a {
        CharSequence ˊ;
        CharSequence ˎ;
        @RestrictTo({androidx.annotation.RestrictTo.d.ॱ})
        protected d ˏ;
        boolean ॱ = false;

        public void ˎ(d dVar) {
            if (this.ˏ != dVar) {
                this.ˏ = dVar;
                if (this.ˏ != null) {
                    this.ˏ.ˊ(this);
                }
            }
        }

        @RestrictTo({androidx.annotation.RestrictTo.d.ॱ})
        public void ॱ(fl flVar) {
        }

        @RestrictTo({androidx.annotation.RestrictTo.d.ॱ})
        public RemoteViews ˊ(fl flVar) {
            return null;
        }

        @RestrictTo({androidx.annotation.RestrictTo.d.ॱ})
        public RemoteViews ˋ(fl flVar) {
            return null;
        }

        @RestrictTo({androidx.annotation.RestrictTo.d.ॱ})
        public RemoteViews ˏ(fl flVar) {
            return null;
        }

        @RestrictTo({androidx.annotation.RestrictTo.d.ॱ})
        public void ˏ(Bundle bundle) {
        }
    }

    public static class b extends a {
        private CharSequence ˋ;

        public b ˏ(CharSequence charSequence) {
            this.ˋ = d.ˎ(charSequence);
            return this;
        }

        @RestrictTo({androidx.annotation.RestrictTo.d.ॱ})
        public void ॱ(fl flVar) {
            if (VERSION.SDK_INT >= 16) {
                BigTextStyle bigText = new BigTextStyle(flVar.ˊ()).setBigContentTitle(this.ˊ).bigText(this.ˋ);
                if (this.ॱ) {
                    bigText.setSummaryText(this.ˎ);
                }
            }
        }
    }

    public interface c {
        d ॱ(d dVar);
    }

    public static class d {
        public CharSequence mContentTitle;
        public Bitmap mLargeIcon;
        public int ʻ;
        public String ʻॱ;
        public CharSequence ʼ;
        public boolean ʼॱ;
        public int ʽ;
        public boolean ʽॱ;
        public boolean ʾ;
        public String ʿ;
        public String ˈ;
        public Bundle ˉ;
        public PendingIntent ˊ;
        public Notification ˊˊ;
        public int ˊˋ;
        public a ˊॱ;
        public int ˊᐝ;
        @RestrictTo({androidx.annotation.RestrictTo.d.ॱ})
        public Context ˋ;
        public RemoteViews ˋˊ;
        public String ˋˋ;
        public boolean ˋॱ;
        public RemoteViews ˋᐝ;
        public String ˌ;
        public RemoteViews ˍ;
        public CharSequence ˎ;
        public int ˎˎ;
        public Notification ˎˏ;
        @RestrictTo({androidx.annotation.RestrictTo.d.ॱ})
        public ArrayList<Action> ˏ;
        @Deprecated
        public ArrayList<String> ˏˎ;
        public int ˏˏ;
        public CharSequence ˏॱ;
        public long ˑ;
        public boolean ͺ;
        public ArrayList<Action> ॱ;
        public CharSequence[] ॱˊ;
        public boolean ॱˋ;
        public int ॱˎ;
        public PendingIntent ॱॱ;
        public int ॱᐝ;
        public RemoteViews ᐝ;
        public boolean ᐝॱ;

        public d(@NonNull Context context, @NonNull String str) {
            this.ˏ = new ArrayList();
            this.ॱ = new ArrayList();
            this.ˋॱ = true;
            this.ʾ = false;
            this.ˊᐝ = 0;
            this.ˊˋ = 0;
            this.ˎˎ = 0;
            this.ˏˏ = 0;
            this.ˎˏ = new Notification();
            this.ˋ = context;
            this.ˋˋ = str;
            this.ˎˏ.when = System.currentTimeMillis();
            this.ˎˏ.audioStreamType = -1;
            this.ʽ = 0;
            this.ˏˎ = new ArrayList();
        }

        @Deprecated
        public d(Context context) {
            this(context, null);
        }

        public d ˊ(long j) {
            this.ˎˏ.when = j;
            return this;
        }

        public d ˊ(int i) {
            this.ˎˏ.icon = i;
            return this;
        }

        public d ˏ(CharSequence charSequence) {
            this.mContentTitle = ˎ(charSequence);
            return this;
        }

        public d ˊ(CharSequence charSequence) {
            this.ˎ = ˎ(charSequence);
            return this;
        }

        public d ˋ(CharSequence charSequence) {
            this.ʼ = ˎ(charSequence);
            return this;
        }

        public d ˊ(int i, int i2, boolean z) {
            this.ॱᐝ = i;
            this.ॱˎ = i2;
            this.ᐝॱ = z;
            return this;
        }

        public d ˎ(RemoteViews remoteViews) {
            this.ˎˏ.contentView = remoteViews;
            return this;
        }

        public d ˎ(PendingIntent pendingIntent) {
            this.ˊ = pendingIntent;
            return this;
        }

        public d ˊ(PendingIntent pendingIntent) {
            this.ˎˏ.deleteIntent = pendingIntent;
            return this;
        }

        public d ˎ(Bitmap bitmap) {
            this.mLargeIcon = ॱ(bitmap);
            return this;
        }

        private Bitmap ॱ(Bitmap bitmap) {
            if (bitmap == null || VERSION.SDK_INT >= 27) {
                return bitmap;
            }
            Resources resources = this.ˋ.getResources();
            int dimensionPixelSize = resources.getDimensionPixelSize(o.ff.b.ˋ);
            int dimensionPixelSize2 = resources.getDimensionPixelSize(o.ff.b.ˎ);
            if (bitmap.getWidth() <= dimensionPixelSize && bitmap.getHeight() <= dimensionPixelSize2) {
                return bitmap;
            }
            double min = Math.min(((double) dimensionPixelSize) / ((double) Math.max(1, bitmap.getWidth())), ((double) dimensionPixelSize2) / ((double) Math.max(1, bitmap.getHeight())));
            return Bitmap.createScaledBitmap(bitmap, (int) Math.ceil(((double) bitmap.getWidth()) * min), (int) Math.ceil(min * ((double) bitmap.getHeight())), true);
        }

        public d ˎ(Uri uri) {
            this.ˎˏ.sound = uri;
            this.ˎˏ.audioStreamType = -1;
            if (VERSION.SDK_INT >= 21) {
                this.ˎˏ.audioAttributes = new Builder().setContentType(4).setUsage(5).build();
            }
            return this;
        }

        public d ˏ(long[] jArr) {
            this.ˎˏ.vibrate = jArr;
            return this;
        }

        public d ˊ(boolean z) {
            ˋ(2, z);
            return this;
        }

        public d ॱ(boolean z) {
            ˋ(8, z);
            return this;
        }

        public d ˏ(boolean z) {
            ˋ(16, z);
            return this;
        }

        public d ˋ(boolean z) {
            this.ʾ = z;
            return this;
        }

        public d ˎ(int i) {
            this.ˎˏ.defaults = i;
            if ((i & 4) != 0) {
                Notification notification = this.ˎˏ;
                notification.flags |= 1;
            }
            return this;
        }

        private void ˋ(int i, boolean z) {
            if (z) {
                Notification notification = this.ˎˏ;
                notification.flags |= i;
                return;
            }
            notification = this.ˎˏ;
            notification.flags &= i ^ -1;
        }

        public d ˏ(int i) {
            this.ʽ = i;
            return this;
        }

        public d ˎ(String str) {
            this.ʻॱ = str;
            return this;
        }

        public d ˎ(boolean z) {
            this.ॱˋ = z;
            return this;
        }

        public d ˎ(Bundle bundle) {
            if (bundle != null) {
                if (this.ˉ == null) {
                    this.ˉ = new Bundle(bundle);
                } else {
                    this.ˉ.putAll(bundle);
                }
            }
            return this;
        }

        public Bundle ॱ() {
            if (this.ˉ == null) {
                this.ˉ = new Bundle();
            }
            return this.ˉ;
        }

        public d ॱ(int i, CharSequence charSequence, PendingIntent pendingIntent) {
            this.ˏ.add(new Action(i, charSequence, pendingIntent));
            return this;
        }

        public d ˊ(a aVar) {
            if (this.ˊॱ != aVar) {
                this.ˊॱ = aVar;
                if (this.ˊॱ != null) {
                    this.ˊॱ.ˎ(this);
                }
            }
            return this;
        }

        public d ॱ(RemoteViews remoteViews) {
            this.ˋˊ = remoteViews;
            return this;
        }

        public d ˊ(RemoteViews remoteViews) {
            this.ˋᐝ = remoteViews;
            return this;
        }

        public d ˋ(@NonNull String str) {
            this.ˋˋ = str;
            return this;
        }

        public d ˋ(c cVar) {
            cVar.ॱ(this);
            return this;
        }

        public Notification ˊ() {
            return new fj(this).ॱ();
        }

        protected static CharSequence ˎ(CharSequence charSequence) {
            if (charSequence != null && charSequence.length() > 5120) {
                return charSequence.subSequence(0, 5120);
            }
            return charSequence;
        }
    }

    public static final class e implements c {
        private int ʻ;
        private int ʼ = -1;
        private int ʽ = 8388613;
        private int ˊ = 1;
        private int ˊॱ;
        private Bitmap ˋ;
        private String ˋॱ;
        private PendingIntent ˎ;
        private ArrayList<Notification> ˏ = new ArrayList();
        private int ͺ = 80;
        private ArrayList<Action> ॱ = new ArrayList();
        private String ॱˊ;
        private int ॱॱ;
        private int ᐝ = 0;

        public /* synthetic */ Object clone() throws CloneNotSupportedException {
            return ॱ();
        }

        public d ॱ(d dVar) {
            Bundle bundle = new Bundle();
            if (!this.ॱ.isEmpty()) {
                if (VERSION.SDK_INT >= 16) {
                    ArrayList arrayList = new ArrayList(this.ॱ.size());
                    Iterator it = this.ॱ.iterator();
                    while (it.hasNext()) {
                        Action action = (Action) it.next();
                        if (VERSION.SDK_INT >= 20) {
                            arrayList.add(ˋ(action));
                        } else if (VERSION.SDK_INT >= 16) {
                            arrayList.add(fn.ˏ(action));
                        }
                    }
                    bundle.putParcelableArrayList("actions", arrayList);
                } else {
                    bundle.putParcelableArrayList("actions", null);
                }
            }
            if (this.ˊ != 1) {
                bundle.putInt("flags", this.ˊ);
            }
            if (this.ˎ != null) {
                bundle.putParcelable("displayIntent", this.ˎ);
            }
            if (!this.ˏ.isEmpty()) {
                bundle.putParcelableArray("pages", (Parcelable[]) this.ˏ.toArray(new Notification[this.ˏ.size()]));
            }
            if (this.ˋ != null) {
                bundle.putParcelable("background", this.ˋ);
            }
            if (this.ॱॱ != 0) {
                bundle.putInt("contentIcon", this.ॱॱ);
            }
            if (this.ʽ != 8388613) {
                bundle.putInt("contentIconGravity", this.ʽ);
            }
            if (this.ʼ != -1) {
                bundle.putInt("contentActionIndex", this.ʼ);
            }
            if (this.ᐝ != 0) {
                bundle.putInt("customSizePreset", this.ᐝ);
            }
            if (this.ʻ != 0) {
                bundle.putInt("customContentHeight", this.ʻ);
            }
            if (this.ͺ != 80) {
                bundle.putInt("gravity", this.ͺ);
            }
            if (this.ˊॱ != 0) {
                bundle.putInt("hintScreenTimeout", this.ˊॱ);
            }
            if (this.ˋॱ != null) {
                bundle.putString("dismissalId", this.ˋॱ);
            }
            if (this.ॱˊ != null) {
                bundle.putString("bridgeTag", this.ॱˊ);
            }
            dVar.ॱ().putBundle("android.wearable.EXTENSIONS", bundle);
            return dVar;
        }

        @RequiresApi(20)
        private static android.app.Notification.Action ˋ(Action action) {
            Bundle bundle;
            android.app.Notification.Action.Builder builder = new android.app.Notification.Action.Builder(action.ˏ(), action.ˊ(), action.ˎ());
            if (action.ˋ() != null) {
                bundle = new Bundle(action.ˋ());
            } else {
                bundle = new Bundle();
            }
            bundle.putBoolean("android.support.allowGeneratedReplies", action.ॱ());
            if (VERSION.SDK_INT >= 24) {
                builder.setAllowGeneratedReplies(action.ॱ());
            }
            builder.addExtras(bundle);
            RemoteInput[] ॱॱ = action.ॱॱ();
            if (ॱॱ != null) {
                for (RemoteInput addRemoteInput : RemoteInput.ˊ(ॱॱ)) {
                    builder.addRemoteInput(addRemoteInput);
                }
            }
            return builder.build();
        }

        public e ॱ() {
            e eVar = new e();
            eVar.ॱ = new ArrayList(this.ॱ);
            eVar.ˊ = this.ˊ;
            eVar.ˎ = this.ˎ;
            eVar.ˏ = new ArrayList(this.ˏ);
            eVar.ˋ = this.ˋ;
            eVar.ॱॱ = this.ॱॱ;
            eVar.ʽ = this.ʽ;
            eVar.ʼ = this.ʼ;
            eVar.ᐝ = this.ᐝ;
            eVar.ʻ = this.ʻ;
            eVar.ͺ = this.ͺ;
            eVar.ˊॱ = this.ˊॱ;
            eVar.ˋॱ = this.ˋॱ;
            eVar.ॱˊ = this.ॱˊ;
            return eVar;
        }

        @Deprecated
        public e ˋ(Bitmap bitmap) {
            this.ˋ = bitmap;
            return this;
        }
    }

    @Nullable
    public static Bundle ॱ(Notification notification) {
        if (VERSION.SDK_INT >= 19) {
            return notification.extras;
        }
        if (VERSION.SDK_INT >= 16) {
            return fn.ˋ(notification);
        }
        return null;
    }
}
